const app = getApp()
var util = require('../../utils/time.js')
Page({
    data: {
        id: '',
        show: false,
        date:''
    },
    onLoad: function (options) {
        this.setData({
            id: options.id ? options.id : "",
            date:util.formatTime(new Date())
        })
        console.log("id:", this.data)
    },
    onChange(event) {
        // event.detail 为当前输入的值
        console.log(event.detail);
    },
    onDisplay() {
        this.setData({
            show: true
        });
    },
    onClose() {
        this.setData({
            show: false
        });
    },
    formatDate(date) {
        return `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()}`;
    },
    onConfirm(event) {
        this.setData({
            show: false,
            date: this.formatDate(event.detail),
        });
    },
    getID(){
        wx.scanCode({
            success:(res)=> {
                this.setData({
                    id: res.result
                })
            }
        })
    }
});